package org.m8.auth.handler.mobile;

import jakarta.annotation.Resource;
import org.m8.auth.handler.mobile.vo.AuthSmsSendReqVO;
import org.m8.util.model.CommonResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.security.PermitAll;

/**
 * 手机验证码登录
 *
 * @author yidanjun
 * @date 2024/9/7
 **/
@RestController
@RequestMapping("/auth/login/mobile")
public class MobileAuthLoginController {

    @Resource
    private MobileAuthLoginHandler mobileAuthLoginHandler;


    /**
     * 发送手机验证码
     *
     * @param req 传参
     * @return 发送结果
     */
    @PermitAll
    @RequestMapping("/sendSmsCode")
    public CommonResult<Boolean> sendSmsCode(AuthSmsSendReqVO req) {
        mobileAuthLoginHandler.sendLoginSmsCode(req.getMobile());
        return CommonResult.success(Boolean.TRUE);
    }

}
